﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageTextLink.aspx.cs" Inherits="Manageweb_ManageLink_ManageTextLink" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    
<link href="../images/css.css" rel="stylesheet" type="text/css" />
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="1" cellpadding="0" cellspacing="0" width="750">
            <tr>
                <td style="font-weight: bold; color: white; background-color: #507cd1; text-align: left">
                    &nbsp;管理文字链接
                    <asp:Label ID="LB_ID" runat="server" Visible="False"></asp:Label></td>
            </tr>
        </table>
        <br />
        <table border="1" cellpadding="0" cellspacing="0" width="750" id="TABLE_Add_Mod" runat="server">
            <tr>
                <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1; text-align: left">
                    &nbsp;<asp:Label ID="LB_TableTitle" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 150px">
                    &nbsp;链接标题</td>
                <td style="text-align: left">
                    &nbsp;<asp:TextBox ID="TB_Title" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RFV_TB_Title" runat="server" ControlToValidate="TB_Title"
                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td>
                    &nbsp;链接地址</td>
                <td style="text-align: left">
                    &nbsp;<asp:TextBox ID="TB_URL" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RFV_TB_URL" runat="server" ControlToValidate="TB_URL"
                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                            ID="REV_TB_URL" runat="server" ControlToValidate="TB_URL" Display="Dynamic" ErrorMessage="格式应为http://..."
                            ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?" ValidationGroup="Btn_Submit"></asp:RegularExpressionValidator></td>
            </tr>
            <tr>
                <td>
                    &nbsp;选项</td>
                <td style="text-align: left">
                    &nbsp;<asp:CheckBox ID="CB_State" runat="server" Checked="True" Text="是否启用" /></td>
            </tr>
            <tr>
                <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1;">
                    <asp:Button ID="Btn_Submit" runat="server" Text="提交" ValidationGroup="Btn_Submit" />&nbsp;<asp:Button
                        ID="Btn_Cancel" runat="server" Text="取消" /></td>
            </tr>
        </table>
        <br />
        <asp:Label id="LB_ManageTextLink" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label>
        <table border="1" cellpadding="0" cellspacing="0" width="750">
            <tr>
                <td>
                    <asp:GridView ID="GV_TextLinkList" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="Link_ID" DataSourceID="ODS_TextLinkList"
                        ForeColor="#333333" Width="100%">
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <Columns>
                            <asp:BoundField DataField="Link_ID" HeaderText="Link_ID" InsertVisible="False" ReadOnly="True"
                                SortExpression="Link_ID" Visible="False" />
                            <asp:BoundField DataField="Link_Title" HeaderText="链接标题" SortExpression="Link_Title" />
                            <asp:TemplateField HeaderText="链接地址" SortExpression="Link_URL">
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Link_URL") %>'
                                        Target="_blank" Text='<%# Eval("Link_URL") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="链接状态" SortExpression="Link_State">
                                <ItemTemplate>
                                    <asp:Button ID="Btn_State" runat="server" CommandArgument='<%# Eval("Link_ID") %>'
                                        OnCommand="Btn_State_Command" Text='<%# FormatState(Eval("Link_State")) %>' Width="55px" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="LBtn_Add" runat="server" OnCommand="LBtn_Add_Command">添加</asp:LinkButton>
                                    <asp:LinkButton ID="LBtn_Mod" runat="server" CommandArgument='<%# Eval("Link_ID") %>'
                                        OnCommand="LBtn_Mod_Command">修改</asp:LinkButton>
                                    <asp:LinkButton ID="LBtn_Del" runat="server" CommandArgument='<%# Eval("Link_ID") %>'
                                        OnCommand="LBtn_Del_Command" OnClientClick="return confirm('删除操作不可恢复，是否继续？')">删除</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Link_DateTime" HeaderText="创建时间" SortExpression="Link_DateTime" />
                        </Columns>
                        <RowStyle BackColor="#EFF3FB" />
                        <EditRowStyle BackColor="#2461BF" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                        <EmptyDataRowStyle BackColor="#507CD1" />
                        <EmptyDataTemplate>
                            <asp:Button ID="Btn_Add" runat="server" OnCommand="LBtn_Add_Command" Text="添加新链接" />
                        </EmptyDataTemplate>
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ODS_TextLinkList" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="GetTextLink" TypeName="AccessDAL.LinkTableAdapters.LinkTableAdapter">
                    </asp:ObjectDataSource>
                </td>
            </tr>
        </table>

    </div>
    </form>
</body>
</html>
